package com.mym;

import java.io.File;

/**
 * @author miao
 * @version 1.0
 * @date 2025/4/16 15:50
 * @description
 */
public class Test4 {
    public static void main(String[] args) {
        File file1 = new File("C:\\ideaProjicts\\01-JavaSE\\day17-code");
        method(file1);


    }
    public static void method(File file){
        if (!(file!=null&& file.exists()&&file.isDirectory())){
            throw new IllegalArgumentException("文件不存在");
        }
        File[] files = file.listFiles();
        for (File file1 : files) {
            if (file1.isFile()){
                System.out.println(file1.getName());
            }else {
                System.out.println(file1.getName());
                method(file1);
            }
        }

    }
}
